home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / gen_vid / scrn_jb.com / D2ASC.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-08-22  |  1.7 KB  |  104 lines

  1. ;
  2. ;this program tests the d2_asc subroutine
  3. ;
  4. ;           written by
  5. ;      John O. Battle, N4OE
  6. ;         c/s 73547,3346
  7. ;    732A Holcomb Bridge Road
  8. ;       Norcross, GA 30071
  9. ;         (404) 449-8536
  10. ;
  11. page      62,132       
  12.   
  13. cseg    segment    para public 'code'  
  14.     assume    cs:cseg,ds:cseg,es:cseg,ss:cseg  
  15.     org    100h  
  16.   
  17. begin:      
  18.  
  19. tester    proc    near 
  20.     assume    cs:cseg,ds:cseg
  21.     mov    bx,cs
  22.     mov    ds,bx
  23.     mov    ax,'A'
  24.     mov    bx,0
  25.     mov    dx,0
  26.     mov    cx,17
  27. tt_1:    push    ax      ;arg3 char
  28.     push    bx      ;arg2 col
  29.     push    dx      ;arg1 line
  30.     call    d2_asc
  31.     add    sp,6
  32.     inc    dx      ;line
  33.     inc    bx      ;col
  34.     inc    bx
  35.     inc    bx
  36.     inc    ax      ;value
  37.     loop    tt_1
  38.     int    20h
  39. tester    endp
  40.  
  41. daz    proc    near
  42. ;
  43. ;This function prints an ASCIIZ string to the monochrome screen.
  44. ;
  45. daz    endp
  46.  
  47.  
  48. d2_asc    proc    near
  49. ;
  50. ;This subroutine writes ascii characters to the monochrome screen.
  51. ;The character is first pushed onto the stack, then the
  52. ;screen line and column numbers are pushed.
  53. ;Next, the function is called, and finally, the stack  is fixed.
  54. ;
  55. ;    push    'A'
  56. ;    push    line
  57. ;    push    column
  58. ;    call    d2
  59. ;    add    sp,6        ;fix stack
  60. ;
  61.     push    ds        ;10 pushes in all
  62.     push    es
  63.     push    ax
  64.     push    bx
  65.     push    cx
  66.     push    dx
  67.     push    si
  68.     push    di
  69.     push    bp
  70.     pushf
  71.  
  72.     mov    bp,sp        ;get args from stack
  73.     mov    ax,[bp+22]    ;arg 1 (2*10 pushes + 2*1)
  74.                 ;screen line number
  75.     mov    ah,0
  76.     mov    bx,80
  77.     mul    bx
  78.     mov    bx,[bp+24]    ;arg 2 (2*10 pushes + 2*2)
  79.     add    ax,bx        ;screen column number
  80.     mov    dx,ax
  81.     shl    dx,1        ;multiply by two
  82.     mov    di,dx
  83.     mov    dl,[bp+26]    ;arg 3 (2*10 pushes + 2*3)
  84.     mov    dh,7
  85.     mov    bx,0b000h    ;monochrome display memory segment
  86.     mov    ds,bx
  87.     mov    ds:[di],dx    ;send to screen
  88.     popf
  89.     pop    bp
  90.     pop    di
  91.     pop    si
  92.     pop    dx
  93.     pop    cx
  94.     pop    bx
  95.     pop    ax
  96.     pop    es
  97.     pop    ds
  98.     ret
  99.  
  100. d2_asc    endp        
  101.  
  102. cseg    ends 
  103.     end    begin 
  104.